<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="panel panel-default panel-intro">
        <div class="panel-heading">
            <ul class="nav nav-tabs">
                <li class="active"><a href="#base" data-toggle="tab">基础</a></li>
                <li><a href="#other" data-toggle="tab">其他</a></li>
                <li><a href="#link" data-toggle="tab">链接</a></li>
            </ul>
        </div>

        <div class="panel-body">
            <div id="myTabContent" class="tab-content">

            <div class="tab-pane fade active in" id="base">
                <div class="form-group hidden">
                    <label for="c-mp_id" class="control-label col-xs-12 col-sm-2">{:__('Mp_id')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-mp_id" data-rule="required" class="form-control" name="row[mp_id]" type="text" value="{:get_admin_applet_id()}">
                        <input id="c-card_type" class="form-control" name="row[card_type]" value="{$Think.get.type}"
                               type="text">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-logo_url" class="control-label col-xs-12 col-sm-2">{:__('Logo_url')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <div class="input-group">
                            <input id="c-logo_url" data-rule="required" class="form-control" size="50" name="row[logo_url]" type="text" placeholder="建议图片尺寸为 300*300">
                            <div class="input-group-addon no-border no-padding">
                                <span><button type="button" id="plupload-logo_url" class="btn btn-danger plupload" data-input-id="c-logo_url" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-logo_url"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                                <span><button type="button" id="fachoose-logo_url" class="btn btn-primary fachoose" data-input-id="c-logo_url" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                            </div>
                            <span class="msg-box n-right" for="c-logo_url"></span>
                        </div>
                        <ul class="row list-inline plupload-preview" id="p-logo_url"></ul>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-brand_name" class="control-label col-xs-12 col-sm-2">{:__('Brand_name')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-brand_name" data-rule="required" class="form-control" name="row[brand_name]" type="text" value="" placeholder="微有货" maxlength="12">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="" placeholder="130元 代金券"  maxlength="15">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-sub_title" class="control-label col-xs-12 col-sm-2">{:__('Sub_title')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-sub_title" class="form-control" name="row[sub_title]" type="text" value="" placeholder="满300元可用"  maxlength="12">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-color" class="control-label col-xs-12 col-sm-2">{:__('Color')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <!--            <select  id="c-color" data-rule="required" class="form-control selectpicker" name="row[color]">
                                        {foreach name="colorList" item="vo"}
                                        <option value="{$key}" {in name="key" value="false"}selected{/in} style="background-color: {$vo};">
                                            {$vo} <div style="background-color: {$vo};"></div>
                                        </option>
                                        {/foreach}
                                    </select>-->

                        <div class="radio" id="c-color" data-rule="required">
                            {foreach name="colorList" item="vo"}
                            <label for="row[color]-{$key}">
                                <input id="row[color]-{$key}" name="row[color]" type="radio" value="{$key}" {in name="key" value=""}checked{/in} />
                                <br>
                                <div class="col-sm-3" style="background-color: {$vo}; height: 50px;"></div></label>
                            {/foreach}
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-notice" class="control-label col-xs-12 col-sm-2">{:__('Notice')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-notice" data-rule="required" class="form-control" name="row[notice]" type="text" value="" maxlength="16" placeholder="使用时向服务员出示此券">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <textarea id="c-description" data-rule="required" class="form-control editor" rows="5" name="row[description]" cols="50" maxlength="1024" placeholder="不可与其他优惠同享 仅限线下使用 (字数限制1024)"></textarea>
                    </div>
                </div>
                <div class="form-group">
                {switch name="Think.get.type"}
                    {case value="CASH"}
                        <label for="c-least_cost" class="control-label col-xs-12 col-sm-2">{:__('CASH_COUPON')} :</label>
                        <div class="col-xs-12 col-sm-8">
                            <div class="input-group">
                                <span class="input-group-addon">满</span>
                                <input id="c-least_cost" data-rule="required" class="form-control" name="row[least_cost]" type="number" value="0">
                                </div>
                        </div>
                    </div>
                <div class="form-group">

                        <label for="c-reduce_cost" class="control-label col-xs-12 col-sm-2"></label>
                        <div class="col-xs-12 col-sm-8">
                            <div class="input-group">
                                <span class="input-group-addon">减</span>
                                <input id="c-reduce_cost" data-rule="required" class="form-control pull-left" name="row[reduce_cost]" type="number" value="0">
                            </div>
                        </div>

                    {/case}
                    {case value="DISCOUNT"}
                        <label for="c-discount" class="control-label col-xs-12 col-sm-2">{:__('DISCOUNT')}:</label>
                        <div class="col-xs-12 col-sm-8">
                            <div class="input-group">
                                <input id="c-discount" data-rule="required" class="form-control" name="row[discount]" type="number" max="9.9" min="1.0" step="0.1" value="9">
                                <span class="input-group-addon">折</span>
                            </div>
                        </div>
                    {/case}
                    {case value="GENERAL_COUPON"}
                        <label for="c-default_detail" class="control-label col-xs-12 col-sm-2">{:__('Default_detail')}:</label>
                        <div class="col-xs-12 col-sm-8">
                            <textarea id="c-default_detail" data-rule="required" class="form-control editor" rows="5" name="row[default_detail]" cols="50" placeholder="{:__('Default_detail')} (字数限制3072)"></textarea>
                        </div>
                    {/case}
                    {case value="GIFT"}
                        <label for="c-gift" class="control-label col-xs-12 col-sm-2">{:__('Gift')}:</label>
                        <div class="col-xs-12 col-sm-8">
                            <textarea id="c-gift" data-rule="required" class="form-control editor" rows="5" name="row[gift]" cols="50" placeholder="{:__('Gift')} (字数限制3072)"></textarea>
                        </div>
                    {/case}
                    {case value="GROUPON"}
                        <label for="c-deal_detail" class="control-label col-xs-12 col-sm-2">{:__('Deal_detail')}:</label>
                        <div class="col-xs-12 col-sm-8">
                            <textarea id="c-deal_detail" data-rule="required" class="form-control editor" rows="5" name="row[deal_detail]" cols="50" placeholder="{:__('Deal_detail')} (字数限制3072)"></textarea>
                        </div>
                    {/case}
                {/switch}
                </div>
                <div class="form-group">
                    <label for="c-quantity" class="control-label col-xs-12 col-sm-2">{:__('Quantity')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-quantity" data-rule="required" class="form-control" name="row[quantity]" type="number" value="10000" maxlength="5">
                    </div>
                </div>
            </div>

            <div class="tab-pane fade" id="other">
                <div class="form-group">
                    <label for="c-date_type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <select  id="c-date_type" data-rule="required" class="form-control selectpicker" name="row[date_type]">
                            {foreach name="dateTypeList" item="vo"}
                            <option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
                <div id="date_block1">
                    <!--// type为 动态时间 -->
                    <div class="form-group">
                        <label for="c-fixed_term" class="control-label col-xs-12 col-sm-2">{:__('Fixed_term')}:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input id="c-fixed_term" data-rule="required" class="form-control" name="row[fixed_term]" type="number" value="30">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="c-fixed_begin_term" class="control-label col-xs-12 col-sm-2">{:__('Fixed_begin_term')}:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input id="c-fixed_begin_term" data-rule="required" class="form-control" name="row[fixed_begin_term]" type="number" value="0">
                        </div>
                    </div>
                    <!-- type为 动态时间// -->
                </div>
                <div id="date_block2" class="hidden">
                    <!--// type为 固定时间戳  -->
                    <div class="form-group">
                        <label for="c-begin_timestamp" class="control-label col-xs-12 col-sm-2">{:__('Begin_timestamp')}:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input id="c-begin_timestamp" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[begin_timestamp]" type="text">

                        </div>
                    </div>
                    <div class="form-group">
                        <label for="c-end_timestamp" class="control-label col-xs-12 col-sm-2">{:__('End_timestamp')}:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input id="c-end_timestamp" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[end_timestamp]" type="text">
                        </div>
                    </div>
                    <!-- type为 固定时间戳 // -->
                </div>
                <hr>
                <!--    <div class="form-group">
                        <label for="c-location_id_list" class="control-label col-xs-12 col-sm-2">{:__('Location_id_list')}:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input id="c-location_id_list" data-rule="required" class="form-control" name="row[location_id_list]" type="number" value="0">
                        </div>
                    </div>-->
                <div class="form-group">
                    <label for="c-get_limit" class="control-label col-xs-12 col-sm-2">{:__('Get_limit')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-get_limit" class="form-control" name="row[get_limit]" type="text" value="1">
                    </div>
                </div>
                <!-- <div class="form-group">
                     <label for="c-use_custom_code" class="control-label col-xs-12 col-sm-2">{:__('Use_custom_code')}:</label>
                     <div class="col-xs-12 col-sm-8">

                         <select  id="c-use_custom_code" data-rule="required" class="form-control selectpicker" name="row[use_custom_code]">
                             {foreach name="useCustomCodeList" item="vo"}
                                 <option value="{$key}" {in name="key" value="false"}selected{/in}>{$vo}</option>
                             {/foreach}
                         </select>

                     </div>
                 </div>
                 <div class="form-group">
                     <label for="c-get_custom_code_mode" class="control-label col-xs-12 col-sm-2">{:__('Get_custom_code_mode')}:</label>
                     <div class="col-xs-12 col-sm-8">

                         <select  id="c-get_custom_code_mode" data-rule="required" class="form-control selectpicker" name="row[get_custom_code_mode]">
                             {foreach name="getCustomCodeModeList" item="vo"}
                                 <option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
                             {/foreach}
                         </select>

                     </div>
                 </div>
                 <div class="form-group">
                     <label for="c-bind_openid" class="control-label col-xs-12 col-sm-2">{:__('Bind_openid')}:</label>
                     <div class="col-xs-12 col-sm-8">

                         <select  id="c-bind_openid" data-rule="required" class="form-control selectpicker" name="row[bind_openid]">
                             {foreach name="bindOpenidList" item="vo"}
                                 <option value="{$key}" {in name="key" value="false"}selected{/in}>{$vo}</option>
                             {/foreach}
                         </select>

                     </div>
                 </div>-->
                <div class="form-group">
                    <label for="c-can_share" class="control-label col-xs-12 col-sm-2">{:__('Can_share')}:</label>
                    <div class="col-xs-12 col-sm-8">

                        <select  id="c-can_share" data-rule="required" class="form-control selectpicker" name="row[can_share]">
                            {foreach name="canShareList" item="vo"}
                            <option value="{$key}" {in name="key" value="true"}selected{/in}>{$vo}</option>
                            {/foreach}
                        </select>

                    </div>
                </div>
                <div class="form-group">
                    <label for="c-can_give_friend" class="control-label col-xs-12 col-sm-2">{:__('Can_give_friend')}:</label>
                    <div class="col-xs-12 col-sm-8">

                        <select  id="c-can_give_friend" data-rule="required" class="form-control selectpicker" name="row[can_give_friend]">
                            {foreach name="canGiveFriendList" item="vo"}
                            <option value="{$key}" {in name="key" value="true"}selected{/in}>{$vo}</option>
                            {/foreach}
                        </select>

                    </div>
                </div>
                <div class="form-group">
                    <label for="c-service_phone" class="control-label col-xs-12 col-sm-2">{:__('Service_phone')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-service_phone" class="form-control" name="row[service_phone]" type="text" value="" placeholder="0755-89895858">
                    </div>
                </div>
            </div>
            <div class="tab-pane fade" id="link">
                <div class="form-group">
                    <label for="c-center_title" class="control-label col-xs-12 col-sm-2">{:__('Center_title')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-center_title"  class="form-control" name="row[center_title]" type="text" maxlength="9" value="立即使用">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-center_sub_title" class="control-label col-xs-12 col-sm-2">{:__('Center_sub_title')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-center_sub_title" class="form-control" name="row[center_sub_title]" type="text" maxlength="12" value="">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-center_url" class="control-label col-xs-12 col-sm-2">{:__('Center_url')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-center_url" class="form-control" name="row[center_url]" type="text" value="" maxlength="128">
                    </div>
                </div>
                <hr>
                <div class="form-group">
                    <label for="c-custom_url_name" class="control-label col-xs-12 col-sm-2">{:__('Custom_url_name')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-custom_url_name" class="form-control" name="row[custom_url_name]" type="text" value="">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-custom_url_sub_title" class="control-label col-xs-12 col-sm-2">{:__('Custom_url_sub_title')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-custom_url_sub_title" class="form-control" name="row[custom_url_sub_title]" type="text" value="">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-custom_url" class="control-label col-xs-12 col-sm-2">{:__('Custom_url')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-custom_url" class="form-control" name="row[custom_url]" type="text" value="">
                    </div>
                </div>
                <hr>
                <div class="form-group">
                    <label for="c-promotion_url_name" class="control-label col-xs-12 col-sm-2">{:__('Promotion_url_name')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-promotion_url_name" class="form-control" name="row[promotion_url_name]" type="text" value="">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-promotion_url" class="control-label col-xs-12 col-sm-2">{:__('Promotion_url')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-promotion_url" class="form-control" name="row[promotion_url]" type="text" value="">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-source" class="control-label col-xs-12 col-sm-2">{:__('Source')}:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-source" class="form-control" name="row[source]" type="text" value="">
                    </div>
                </div>
            </div>
        </div>
        </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script>
    var dateType = document.getElementById('c-date_type');
    dateType.addEventListener("change", function(){
        var type = this.value;
        if(type === 'DATE_TYPE_FIX_TIME_RANGE'){
            document.getElementById('date_block1').className = 'hidden';
            document.getElementById('date_block2').className = 'visible';
        }else{
            document.getElementById('date_block1').className = 'visible';
            document.getElementById('date_block2').className = 'hidden';
        }
//        alert(type);
//        console.log(1);
    }, false);
</script>
